<script setup>
import { computed } from 'vue'
import { useRoute } from 'vue-router'

const route = useRoute()

// 处理面包屑数据
const breadArr = computed(() => {
  const newArr = route.matched.map((item) => {
    return {
      name: item.meta.name,
      path: item.path,
    }
  })
  return newArr
})
</script>

<template>
  <el-breadcrumb>
    <el-breadcrumb-item
      v-for="item in breadArr"
      :key="item.path"
      :to="item.path"
      >{{ item.name }}</el-breadcrumb-item
    >
  </el-breadcrumb>
</template>
